/**
 * Licensed to the Apache Software Foundation （ASF） under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * （the "License"）； you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * <p>
 * https://www.q3z3.com
 * QQ : 939313737
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.platform.modules.sys.controller;

import com.platform.common.web.controller.BaseController;
import com.platform.common.web.utils.Pager;
import com.platform.common.web.vo.AjaxResult;
import com.platform.modules.sys.domain.SysLog;
import com.platform.modules.sys.service.SysLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * <p>
 * 系统日志 控制层
 * </p>
 */
@Controller
@RequestMapping("/sys/log")
public class SysLogController extends BaseController {

    @Resource
    private SysLogService sysLogService;

    /**
     * 去列表页面
     *
     * @return
     */
    @RequiresPermissions(value = {"sys:log:query"})
    @GetMapping(value = "/toList")
    public String toList() {
        return "sys/log/list" ;
    }

    /**
     * 列表数据(分页)
     *
     * @return
     */
    @RequiresPermissions(value = {"sys:log:query"})
    @PostMapping(value = "/query")
    @ResponseBody
    public AjaxResult query(SysLog sysLog) {
        startPage("create_time desc");
        Pager<SysLog> pager = sysLogService.queryPager(sysLog);
        return AjaxResult.success(pager);
    }

    /**
     * 删除数据
     *
     * @return
     */
    @RequiresPermissions(value = {"sys:log:delete"})
    @GetMapping(value = "/delete/{ids}")
    @ResponseBody
    public AjaxResult delete(@PathVariable Long[] ids) {
        sysLogService.deleteByIds(ids);
        return AjaxResult.successMsg("删除成功");
    }


}

